package com.dries.portal.admin.controller;

import com.dries.portal.admin.entity.UmsRole;
import com.dries.portal.admin.service.IUmsRoleService;
import com.dries.security.common.api.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Map;

/**
 * 后台用户角色表
 *
 * @author dries
 * @email samphsanie@gmail.com
 * @date 2020-09-22 18:23:25
 */
@RestController
@RequestMapping("UmsRole")
public class UmsRoleController {

    @Resource
    private IUmsRoleService umsRoleService;

    /**
     * 列表
     */
    @GetMapping("/list")
    public CommonResult list(@RequestParam Map<String, Object> params){

        
        return CommonResult.success();
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    public CommonResult info(@PathVariable("id") Long id){
		UmsRole umsRole = umsRoleService.getById(id);

        return CommonResult.success();
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public CommonResult save(@RequestBody UmsRole umsRole){
		umsRoleService.save(umsRole);

        return CommonResult.success();
    }

    /**
     * 修改
     */
    @PutMapping("/update")
    public CommonResult update(@RequestBody UmsRole umsRole){
		umsRoleService.updateById(umsRole);

        return CommonResult.success();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
    public CommonResult delete(@RequestBody Long[] ids){
		umsRoleService.removeByIds(Arrays.asList(ids));

        return CommonResult.success();
    }

}
